package cn.kgc.tangcco.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author 李昊哲
 * @Description
 * @create 2021/1/2 13:31
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Configuration
public class FdfsParam {
    @Value("${fdfs_storage_proxy.protocol}")
    private String fdfs_storage_proxy_protocol;

    @Value("${fdfs_storage_proxy.domain}")
    private String fdfs_storage_proxy_domain;

    @Value("${fdfs_storage_proxy.port}")
    private String fdfs_storage_proxy_port;

    @Value("${fdfs_storage_proxy.context}")
    private String fdfs_storage_proxy_context;

    private String proxyFullUrl;

    /**
     * 带分组的路径
     */
    private String fullPath;

    /**
     * 缩略图路径
     */
    private String thumbImagePath;

    public String getProxyFullUrl() {
        return fdfs_storage_proxy_protocol + fdfs_storage_proxy_domain + ":" + fdfs_storage_proxy_port + fdfs_storage_proxy_context;
    }

    public void setFullPath(String fullPath) {
        getProxyFullUrl();
        this.fullPath = fullPath;
    }

    public void setThumbImagePath(String thumbImagePath) {
        getProxyFullUrl();
        this.thumbImagePath = thumbImagePath;
    }
}
